<template>
  <el-form ref="formRef" :model="formModel" :rules="rules" label-width="120px" class="form" label-position="right" status-icon>
    <el-form-item label="申请人:">
      {{ initData.name }}
    </el-form-item>
    <el-form-item label="退款金额(元):">
      {{ initData.money }}
    </el-form-item>
    <el-form-item label="审核状态:" prop="check">
      <query-dict :dict-list="refundList" show-type="radio" :value.sync="formModel.check"></query-dict>
    </el-form-item>
    <el-form-item label="审核结果说明:" :prop="formModel.check === 2 ? 'remark' : ''">
      <el-input
        type="textarea"
        :rows="4"
        maxlength="100"
        show-word-limit
        :placeholder="formModel.check === 2 ? '请输入审核不通过原因' : '请输入审核结果'"
        v-model.trim="formModel.remark"
      ></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
import MixinForm from 'mixins/form'

export default {
  mixins: [MixinForm],
  props: {
    initData: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      refundList: [
        {
          label: '通过',
          value: 1
        },
        {
          label: '不通过',
          value: 2
        }
      ],
      rules: {
        remark: [{ required: true, message: '审核不通过原因不能为空', trigger: 'blur' }]
      }
    }
  },
  computed: {
    formModel: {
      get() {
        return this.initData
      },
      set(val) {
        this.$emit('update:init-data', val)
      }
    }
  }
}
</script>
